<?php

class datagrid_builder
{		
	function datagrid_builder()
	{
		$this->grid = "";
	}
	
	function newGrid($style="",$class="")
	{
		$form = "<table style='$style' class='$class'>";
		
		$this->form = $form;
	}
		
	function closeForm()
	{
		$this->form .= "</table></form>";
	}
	
	function addElement($type,$value,$name,$left_value="",$style='')
	{
		$element = "";
		$element .= "<tr>";
		if ($left_value != "")
		{
			$element .= "<td style='min-width:100px'><p>$left_value</p></td>";	
			$element .= "<td style='min-width:100px'><input type='$type' value='$value' name='$name' id='$name' style='$style' /></td>";
		}
		else
		{		
			$element .= "<td></td><td style='min-width:100px'><input type='$type' value='$value' name='$name' id='$name' style='$style' /></td>";
		}
		$element .= "</tr>";
		$this->form .= $element;
	}
	
	function validate()
	{
		$retval = false;
		if (isset($_REQUEST['submit']))
		{
			$retval = true;
		}
		
		return $retval;
	}
	
	function formShow()
	{
		$this->closeForm();
		echo $this->form;
	}
}
?>